const channel=new BroadcastChannel("worker_channel");

const worker=new Worker("./worker.js")
channel.onmessage=({data})=>{
    console.log(`heard ${data} on page`);
}

setTimeout(()=>channel.postMessage("foo"),1000);